<style type="text/css">
.calendar_date_select{
    float:left;
    margin-top:10px;
}
</style>
<script type="text/javascript">
function setDateSelected(date){
    window.location.href = window.location.pathname.replace(/(\/voluntario\/disponibilidade\/)(\d+)\/(.*)/, "$1$2") + '/' + date
}
</script>
<h3>Selecione a data disponível</h3>
<%= calendar_date_select_tag "e_date", @date, :embedded => true, :year_range => 0.years.ago..1.years.since, :onchange => "setDateSelected($F(this))" %>
<% if not @date.nil? %>
<% form_tag :dia => @date.day, :mes => @date.month, :ano => @date.year do %>
<table class="calendario">
    <thead>
        <tr>
            <th class="check">Disponivel</td>
            <th>Hora</td>
        </tr>
    </head>
    <tbody>
    <% for hora in 7..18 %>
        <tr>
            <th class="check">
                <% if @disponibilidades[hora].nil? %>
                <%= check_box 'disponibilidade', '', {}, hora %> 
                <% else %>
                <%= check_box 'disponibilidade', '', {:checked => "checked"}, hora %> 
                <% end %>
            </td>
            <td class="hora"><%= hora %>:00</td>
        </tr>
    <% end %>
    </tbody>
    <tfoot>
        <tr><td colspan="2"><%= submit_tag 'Salvar', :class => "button" %></td></tr>
    </tfoot>
</table>
<% end %>
<% end %>
<%= javascript_include_tag "jquery-1.3.2.min" %>
<script type="text/javascript">
jQuery.noConflict()
with({$: jQuery}){
    $(function(){
        $('.calendario tbody tr:odd').addClass('odd')
    })
}
</script>
